<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
   	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
   	<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" />
	<title></title>
	<link href="/plugins/layui/css/layui.css" rel="stylesheet" />
</head>
<body>
<textarea id="demo" style="display: none;"></textarea>
</body>
<script src="/plugins/layui/layui.js"></script>
<script src="/plugins/layui/lay/modules/layedit.js"></script>
<script>
layui.use('layedit', function(){
  var layedit = layui.layedit;
  //layedit.build('demo'); //建立编辑器
  var index = layedit.build('demo', {
	                  tool: ['strong', 'italic', 'underline', 'del', '|', 'left', 'center', 'right', 'link', 'unlink', 'face'],//设置需要的控件
	                  height: 280 //设置高度
	});
  //富文本赋值
  var body = "<b>hello Layui</b>";
  layedit.setContent(index,body);
  
  //富文本取值  
  var text = layedit.getContent(index);//获取html
  var text2 = layedit.getText(index) // 获取纯文本
  alert("30"+text+"---"+text2);
  
});
</script>

</html>

